/*
  ******************************************************************************
  * @file    dspl.h
  * @author  Denis Egorov
  * @version V1.7
  * @date 12/10/2020  
  * @brief   
  ******************************************************************************
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DSPL_H
#define __DSPL_H

/* Includes ------------------------------------------------------------------*/
#include "def.h"
#include "MDR32F9Qx_port.h"             // Keil::Drivers:PORT
#include "MDR32F9Qx_i2c.h"              // Keil::Drivers:I2C

/* User define ---------------------------------------------------------------*/
#define DSPL_ADDR_1  (0x3C << 1)
#define DSPL_ADDR_2  (0x3D << 1)
	
/* Variables ---------------------------------------------------------*/
static uint8_t char_array[29][22] = {   
	                                      {0x00, 0x00, 0xF8, 0xFC, 0x0C, 0x0C, 0x0C, 0xFC, //'0'
																			   0xF8, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x18,  
																			   0x18, 0x18, 0x1F, 0x0F, 0x00, 0x00},
	
	                                      {0x00, 0x00, 0x00, 0x30, 0x30, 0xF8, 0xF8, 0x00, //'1'
		                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
																			   0x1F, 0x1F, 0x18, 0x18, 0x00, 0x00},

	                                      {0x00, 0x00, 0x30, 0x18, 0x18, 0x18, 0x98, 0xF8, //'2'
		                                     0x70, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0x1E,
  																		   0x1B, 0x19, 0x18, 0x18, 0x00, 0x00},

	                                      {0x00, 0x00, 0x30, 0x98, 0x98, 0x98, 0x98, 0xF8, //'3'
	                                       0x70, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x19, 0x19,
 																			   0x19, 0x19, 0x1F, 0x0F, 0x00, 0x00},

	                                      {0x00, 0x00, 0x00, 0xC0, 0xF0, 0x38, 0xF8, 0xF8, //'4'
		                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x06,
 																			   0x06, 0x1F, 0x1F, 0x06, 0x00, 0x00},

	                                      {0x00, 0x00, 0xF8, 0xF8, 0x98, 0x98, 0x98, 0x98, //'5'
		                                     0x18, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x19, 0x19,
																				 0x19, 0x19, 0x1F, 0x0F, 0x00, 0x00},
																			 
																			  {0x00, 0x00, 0xC0, 0xE0, 0xB0, 0x98, 0x98, 0x98, //'6'
																				 0x18, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x19, 
																				 0x19, 0x19, 0x1F, 0x0F, 0x00, 0x00},
																			 
																			  {0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x98, 0xF8, //'7'
																				 0x78, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0x06,
																				 0x03, 0x01, 0x00, 0x00, 0x00, 0x00},
																			 
																			  {0x00, 0x00, 0x38, 0xFC, 0xCC, 0xCC, 0xCC, 0xFC, //'8'
																				 0x38, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x18, 
																				 0x18, 0x18, 0x1F, 0x0F, 0x00, 0x00},
																			 
																			  {0x00, 0x00, 0xF0, 0xF8, 0x98, 0x98, 0x98, 0xF8, //'9'
                                         0xF0, 0x00, 0x00, 0x00, 0x00, 0x18, 0x19, 0x19,
																				 0x19, 0x0D, 0x07, 0x03, 0x00, 0x00},	
																			
                                        {0x00, 0x00, 0x00, 0xE0, 0xF8, 0x38, 0xF8, 0xE0, //'A' 0A
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x06,
																				 0x06, 0x06, 0x1F, 0x1F, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, //'H' 0B
																				 0xF8, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x01,
																				 0x01, 0x01, 0x1F, 0x1F, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xF0, 0xF8, 0x18, 0x18, 0x18, 0x38, //'C' 0C
																				 0x30, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x18,
																				 0x18, 0x18, 0x1C, 0x0C, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, 0x80, 0xC0, //'m' 0D
																				 0xC0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x01,
																				 0x06, 0x01, 0x1F, 0x1F, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x60, 0x60, 0xF8, 0xF8, 0x60, 0x60, //'t' 0E
                                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
																				 0x0F, 0x1C, 0x18, 0x10, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, //'x' 0F
																				 0xC0, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1D, 0x07, 
																				 0x02, 0x07, 0x1D, 0x18, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0xC0, //'y' 10
																				 0xC0, 0x00, 0x00, 0x00, 0x00, 0x30, 0x31, 0x33,
																				 0x37, 0x3E, 0x1f, 0x0F, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, //'z' 11
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0x1E,
																				 0x1B, 0x19, 0x18, 0x00, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, //'+' 12
																				 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 
																				 0x07, 0x07, 0x01, 0x01, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, //'-' 13
																				 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
																				 0x01, 0x01, 0x01, 0x01, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, //'=' 14
																				 0x60, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06,
																			   0x06, 0x06, 0x06, 0x06, 0x00, 0x00},
																				 
																				{0x00, 0xC0, 0xE0, 0x60, 0xC0, 0x80, 0x00, 0x00, //'~' 15
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
																				 0x03, 0x06, 0x07, 0x03, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //',' 16
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x30,
																				 0x1F, 0x0F, 0x07, 0x00, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x30, 0x78, 0x78, 0x30, 0x00, //':' 17
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC, 0x1E,
																				 0x1E, 0x0C, 0x00, 0x00, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, //'|' 18
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F,
																				 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0x78, 0x18, //'/' 19
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1E, 0x07,
																				 0x01, 0x00, 0x00, 0x00, 0x00, 0x00},
																				 
																				{0x00, 0x00, 0x30, 0x48, 0x48, 0x30, 0x00, 0x00, //'�' 1A
																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
																				 0x00, 0x00, 0x00,0x00, 0x00, 0x00},
																				 
																				{0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, //'�' 1B
 																				 0x80, 0x80, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
																				 0x01, 0x01, 0x01, 0x01, 0x01,  0x00},
																				 
																				{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //' ' 1C
 																				 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
																				 0x00, 0x00, 0x00, 0x00, 0x00,  0x00} 
																		};
 																		
/* Exported functions prototypes -------------------------------------------- */		
uint8_t DSPL_Start(uint8_t Addr); //Display start
uint8_t DSPL_Stop(uint8_t Addr);	//Display stop																	
void DSPL_Clear(uint8_t Addr); //Display clearing
void DSPL_FillStr(uint8_t Addr, uint8_t* Str_Array); //Display string
void LoadStrArray(uint8_t* Str_Array, uint8_t* Str); //Loading of Str_Array with data of Str
#endif 
